package wec_wallet.ebo.com.activity;

import android.os.Bundle;
import android.widget.EditText;

import java.util.HashMap;
import java.util.Map;

import bassproject.ebo.com.ebobass.activity.MyBassAppCompatActivity;
import bassproject.ebo.com.ebobass.http_utils.interfaces.IHttpPostListener;
import butterknife.BindView;
import butterknife.ButterKnife;
import wec_wallet.ebo.com.R;
import wec_wallet.ebo.com.utils.Functions;
import wec_wallet.ebo.com.utils.URLs;

/**
 * Created by admin on 2018/3/29.
 */

public class NicknameActivity extends MyBassAppCompatActivity {


    @BindView(R.id.editText)
    EditText editText;

    private String oldName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_modify_nickname);
        ButterKnife.bind(this);
        oldName = getIntent().getStringExtra("nick");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        uploadNickName();
    }

    private void uploadNickName() {
        String newName = editText.getText().toString();
        if (oldName.equals(newName)) {
            return;
        }
        Map<String, Object> postParams = new HashMap<String, Object>();

        Functions.post(this, URLs.CHANGE_NICKNAME, postParams, new IHttpPostListener() {
            @Override
            public void onTimeOut() {

            }
            @Override
            public void responseSuccess(String result) {


            }
        }, true, true);
    }


}
